package twinb.text;
import java.util.List;
import java.util.ArrayList;

public class Kgram {
	static int k=3;
	
	public List<String> getKgrams(List<String> words)
	{
		List<String> kgrams=new ArrayList<String>();
		String s="";
		for(int i=1;i<=k;++i)
			for(int j=0;j+i<=words.size();++j)
			{
				s="";
				for(int t=0;t<i;++t)
				{
					if(t!=0)
						s+=" ";
					s+=words.get(j+t);
				}
				kgrams.add(s);
			}
		return kgrams;
	}
}
